<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css" />
<link type="text/css"
	href="${pageContext.request.contextPath}/themes/icon.css"
	rel="stylesheet">
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
<title>Insert title here</title>
</head>
<script type="text/javascript">
$(function(){
	
	$('#dg').datagrid({    
	    url:'ShowGuoFanPrice_showGuoFanPrice',
	    rownumbers:true,
	    pagination:true,
	    pageSize:10,
	    pageList:[10,15,20],
	    columns:[[   
            {field:'checkbox',title:'ck',width:100,checkbox:true},
	        {field:'disid',title:'站点编号',width:100},    
	        {field:'disname',title:'站点名',width:100},    
	        
	        {field:'cuser',title:'站点负责人姓名',width:100}, 
	        {field:'disscope',title:'配送范围',width:100}, 
	        {field:'disprice',title:'价格比例',width:100}, 
	        
	        {field:'fkgc',title:'首公斤费用',width:100},
	        {field:'subkilogramme',title:'超出的每公斤费用',width:100},
	        {field:'mtm',title:'体积转质量率',width:100},
	    ]] ,
	    
	    toolbar: [{
			iconCls: 'icon-edit',
			text:'编辑价格',
			handler: function(){
				var a=$('#dg').datagrid('getSelections'); 
				if(a.length==1){
					$('#win').window('open');
					$('#tb').textbox('setValue',a[0].disid);
					$('#tb1').textbox('setValue',a[0].fkgc);
					$('#tb2').textbox('setValue',a[0].subkilogramme);
					$('#tb3').textbox('setValue',a[0].mtm);
				}else{
					$.messager.alert('我的消息','请选择一行进行编辑','info');


				}
				
	    	}			
		
		}]
	});  


    $('#btn').bind('click', function(){ 
    var disid=$('#tb').textbox('getValue');
    var fkgc=$('#tb1').textbox('getValue');
    var subkilogramme=$('#tb2').textbox('getValue');
    var mtm=$('#tb3').textbox('getValue');
    $.ajax({
    	url:'UpdateGuoFanPrice_updateGuoFanPrice',
    	type:'post',
    	data:{'disid':disid,'fkgc':fkgc,'subkilogramme':subkilogramme,'mtm':mtm},
    	dataType:'json',
    	success:function(data){
    		if(data==1){
    			$.messager.show({
    				title:'我的消息',
    				msg:'保存成功',
    				timeout:2000,
    				showType:'slide'
    			});
    			$('#win').window('close');
    			$('#dg').datagrid('reload');
    		}
    	}
    })
    });    


    $('#btn1').bind('click', function(){    
    	$('#win').window('close');  
    });    


	
})
</script>
<body>

<table id="dg"></table> 

<div id="win" class="easyui-window" title="信息管理" style="width:600px;height:400px"   
        data-options="closed:true,closable:true,modal:true">   

<div style="margin-top: 50px;margin-left: 100px">
<div style="display:none">
站点编号<input id="tb" type="text" style="width:300px" class="easyui-textbox"><br></div>
首重费用<input id="tb1" type="text" style="width:300px" class="easyui-textbox"><br><br><br>
续重费用<input id="tb2" type="text" style="width:300px" class="easyui-textbox"><br><br><br>
容转重率<input id="tb3" type="text" style="width:300px" class="easyui-textbox"><br><br><br>
</div><br><br><div style="margin-top: 30px;margin-left: 220px">
<a id="btn" href="#" class="easyui-linkbutton">保存</a>
<a id="btn1" href="#" class="easyui-linkbutton">取消</a></div>
</div> 

</body>
</html>